package Exercise104;

public class PhoneNum {
    public static void main(String[] args) {

        //字符截取操作
        //arr.substring(0,3); 截取索引为012的字符

//        Scanner sc = new Scanner(System.in);
//        String input = sc.next();
//        String result = "";
//        for (int i = 0; i < input.length(); i++) {
//            if (i >= 3 && i <= 6) {
//                result += "*";
//            } else {
//                char c = input.charAt(i);
//                result += c;
//            }
//        }
//        System.out.println(result);


        //打印出生年月
//        Scanner sc = new Scanner(System.in);
//        System.out.println("输入身份证");
//        String id = sc.next();
//        String year = id.substring(6, 10);
//        String month = id.substring(10, 12);
//        String day = id.substring(12, 14);
//
//        System.out.println("出生年月日为：" + year + "年" + month + "月" + day + "日");
//
////        switch(oe){
////            case "0","2","4","6","8":
////                System.out.println("性别：女");
////                break;
////            case "1","3","5","7","9":
////                System.out.println("性别：男");
////                break;
////        }
//        char gender = id.charAt(16);  //
//        if (gender % 2 == 0) {
//            System.out.println("性别：女");
//        } else {
//            System.out.println("性别：男");
//        }


        //敏感词替换
        //String replace(旧值，新值);
        //arr.charAt(i); 用来获取字符串中索引为i的字符
        String talk = "CNM,臭SB,QNMD,在我对面我打死你，TMD";
        //定义一个敏感词库
        String[] senWord = {"CNM", "TMD", "QNMD", "SB"};
        //进行替换
        for (int i = 0; i < senWord.length; i++) {
            talk = talk.replace(senWord[i], "***");
        }
        System.out.println(talk);




    }
}
